package my.sample.io.file.delete;

import java.io.File;
import java.io.FilenameFilter;

public class WildcardDelete {

	public static void main(String[] args) {
		
		System.out.println(test());

		File folder = new File("/tmp/test");
		String routerip = "3.3.3.3";
		final String filePattern = routerip + "_[0-9]*.json";
		System.out.println(filePattern);
		File[] files2 = folder.listFiles(new FilenameFilter() {

			private String ip;
			@Override
			public boolean accept(final File dir, final String name) {
				return name.matches(filePattern);
			}
		});

		
		for ( File file : files2 ) {
			file.delete();
		}
		
	}
	
	public static boolean test() {
		return true & true;
	}
}
